home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / machserver / 1.098 / include / sysStats.h < prev    next >
C/C++ Source or Header  |  1991-05-29  |  14KB  |  336 lines

  1. /*
  2.  * sysStat.h --
  3.  *
  4.  *    User-level definitions of routines and types for system statistics
  5.  *    returned by the Sys_Stats system call.  Instead of a /dev/kmem
  6.  *    type interface, we have calls to return specific kernel structure.
  7.  *    The kernel call takes the following arguments:
  8.  *    Sys_Stats(command, option, argPtr)
  9.  *    commands are defined below, and option and argPtr are interpreted
  10.  *    differently by each command.  Typically argPtr is a buffer that
  11.  *    gets filled in with a system structure, and option is used to
  12.  *    indicate the size, or to control tracing, or isn't used at all.
  13.  *
  14.  * Copyright 1986, 1988 Regents of the University of California
  15.  * Permission to use, copy, modify, and distribute this
  16.  * software and its documentation for any purpose and without
  17.  * fee is hereby granted, provided that the above copyright
  18.  * notice appear in all copies.  The University of California
  19.  * makes no representations about the suitability of this
  20.  * software for any purpose.  It is provided "as is" without
  21.  * express or implied warranty.
  22.  *
  23.  * $Header: /sprite/src/lib/include/RCS/sysStats.h,v 2.35 91/05/29 09:12:19 mendel Exp $ SPRITE (Berkeley)
  24.  *
  25.  */
  26.  
  27. #ifndef _SYSSTATS
  28. #define _SYSSTATS
  29.  
  30. /*
  31.  * Commands for the Sys_Stats system call.
  32.  *    SYS_RPC_CLT_STATS - Return the Rpc_CltStats structure that contains
  33.  *        client-side statistics for the RPC system. (see rpc.h)
  34.  *    SYS_RPC_SRV_STATS - Return the Rpc_SrvStats structure that contains
  35.  *        server-side statistics for the RPC system. (see rpc.h)
  36.  *    SYS_SYNC_STATS - Return the Sync_Instrument structure which
  37.  *        contains lock and wakeup counts. (see kernel/sync.h)
  38.  *    SYS_SCHED_STATS - Return the Sched_Instrument structure which
  39.  *        contains idle time and context switch counts (kernel/sched.h)
  40.  *    SYS_VM_STATS - Return the Vm_Stat structure which contains every
  41.  *        concievable VM statistic, fault counts etc. (kernel/vmStat.h)
  42.  *    SYS_RPC_TRACE_STATS - Used to both return the trace of recent RPCs,
  43.  *        and to enable/disable the trace, see options below.
  44.  *    SYS_FS_PREFIX_STATS - Return entries from the prefix table. (see fs.h)
  45.  *    SYS_PROC_TRACE_STATS - Used to both return the process migration
  46.  *        trace, and to enable/disable the trace, see options below.
  47.  *    SYS_SYS_CALL_STATS - Return the array of system call counters.
  48.  *        option indicates how many integers the buffer argPtr contains.
  49.  *    SYS_RPC_SERVER_HIST - Return the service time histogram for the RPC
  50.  *        indicated by option. (see kernel/rpcHistogram.h)  If option
  51.  *        is less than or equal to zero the histogram is cleared.
  52.  *    SYS_RPC_CLIENT_HIST - Return service time as obseved by a client.
  53.  *    SYS_NET_GET_ROUTE - Return the route table entry for a particular host.
  54.  *        The data returned are three integers: flags, spriteID, and
  55.  *        route type.  This is then followed by type specific data,
  56.  *        either an ethernet address or an internet address.
  57.  *    SYS_RPC_SRV_STATE - Return the RpcServerState structure for the
  58.  *        RPC server indexed by option.  (see kernel/rpcServer.h)
  59.  *    SYS_RPC_CLT_STATE - Return the RpcClientState structure for the
  60.  *        RPC client channel indexed by option.  (see kernel/rpcClient.h)
  61.  *    SYS_NET_ETHER_STATS - Return the Net_EtherStats structure which
  62.  *        contains interface statistics.  (see kernel/net.h)
  63.  *     SYS_RPC_ENABLE_SERVICE - Enable/disable the service side of the RPC
  64.  *        system.  A non-zero option value enables, zero disables.
  65.  *    SYS_GET_VERSION_STRING - Return the kernel version string.  option
  66.  *        indicates how big the users buffer is.
  67.  *    SYS_PROC_MIGRATION - Enable/Disable process migration to this host.
  68.  *        See options defined below.
  69.  *    SYS_DISK_STATS - Return the Sys_DiskStats structure defined below.
  70.  *        option corresponds to a kernel controller table index.
  71.  *    SYS_FS_PREFIX_EXPORT - Return the export list of a prefix.  The
  72.  *        option parameter indicates the size of the buffer argPtr.
  73.  *        argPtr should contain the prefix upon entry, and is
  74.  *        overwritten with an integer array of SpriteIDs that
  75.  *        corresponds to the export list for the prefix.
  76.  *    SYS_LOCK_STATS - Return the locking statistics. option indicates the
  77.  *        size of the buffer in units of Sync_LockStat structures.
  78.  *    SYS_RPC_SRV_COUNTS - Return the count of RPC service calls.  The
  79.  *        option argument is unused.  If argPtr == NULL then the
  80.  *        counts are printed on the console, otherwise it should be
  81.  *        the address of an integer array size RPC_LAST_COMMAND+1
  82.  *    SYS_RPC_CALL_COUNTS - Return the count of RPC calls.  The
  83.  *        option argument is unused.  If argPtr == NULL then the
  84.  *        counts are printed on the console, otherwise it should be
  85.  *        the address of an integer array size RPC_LAST_COMMAND+1
  86.  *    SYS_LOCK_RESET_STATS - Reset the locking statistics.
  87.  *    SYS_INST_COUNTS - Return information from instruction counts. This
  88.  *        only works on special spur kernels.
  89.  *    SYS_RESET_INST_COUNTS - Reset instruction counts.
  90.  *    SYS_RECOV_STATS - Return information about the recov module.
  91.  *    SYS_RECOV_PRINT - Change printing level of recov module traces.
  92.  *    SYS_FS_RECOV_INFO - Return info with names about the state of
  93.  *        files for recovery testing.
  94.  *    SYS_RECOV_CLIENT_INFO - Dump state on server about per-client recovery.
  95.  *    SYS_RPC_SERVER_TRACE - Turn tracing of rpc servers on or off.
  96.  *    SYS_RPC_SERVER_INFO - Return rpc server tracing info to user.
  97.  *    SYS_RPC_SERVER_FREE - Free up space used by rpc server tracing.
  98.  *    SYS_RPC_SET_MAX - Set the maximum number of server processes.
  99.  *    SYS_RPC_SET_NUM - Create enough server processes to have this many.
  100.  *    SYS_RPC_NEG_ACKS - Turn on or off negative acks on the server.
  101.  *    SYS_RPC_CHANNEL_NEG_ACKS -  Set client policy on or off for handling
  102.  *        neg acks by ramping down the number of client channels.
  103.  *    SYS_RECOV_ABS_PINGS - Whether to use absolute ping intervals or not.
  104.  *    SYS_RECOV_PRINT - Set the recovery print level.
  105.  *    SYS_RPC_NUM_NACK_BUFS - Set the number of negative acknowledgement
  106.  *        buffers.
  107.  *    SYS_START_STATS - Turn on the kernel's periodic printing of sched
  108.  *        and io stats.  TEMPORARY for recovery measurements.
  109.  *    SYS_END_STATS - Turn off the kernel's periodic printing of sched
  110.  *        and io stats.  TEMPORARY for recovery measurements.
  111.  *    SYS_TRACELOG_STATS - Trace log buffer commands (for SOSP91 paper).
  112.  *      SYS_DEV_CHANGE_SCSI_DEBUG - Change debug level for scsi driver.
  113.  *    SYS_SCHED_MORE_STATS - More counters from the sched module (SOSP91).
  114.  *    SYS_FS_SOSP_MIG_STATS - Counters from the fs module (SOSP91).
  115.  *    SYS_FS_SOSP_NAME_STATS - Undocumented flag of Ken's (SOSP91).
  116.  *    SYS_FSCACHE_EXTRA_STATS - Info about cache blocks (SOSP91).
  117.  *    SYS_RPC_SANITY_CHECK - Toggle sanity checks on rpc packets.
  118.  *    SYS_FS_EXTRA_STATS - Extra fs stats that should go into fsStats for
  119.  *                the next global compile.
  120.  */
  121.  
  122. #define SYS_RPC_CLT_STATS    1
  123. #define SYS_RPC_SRV_STATS    2
  124. #define SYS_SYNC_STATS        3
  125. #define SYS_SCHED_STATS        4
  126. #define SYS_VM_STATS        5
  127. #define SYS_RPC_TRACE_STATS    6
  128. #define SYS_FS_PREFIX_STATS    7
  129. #define SYS_PROC_TRACE_STATS    8
  130. #define SYS_SYS_CALL_STATS    9
  131. #define SYS_RPC_SERVER_HIST    10
  132. #define SYS_RPC_CLIENT_HIST    11
  133. #define SYS_NET_GET_ROUTE    12
  134. #define SYS_RPC_SRV_STATE    13
  135. #define SYS_RPC_CLT_STATE    14
  136. #define    SYS_NET_ETHER_STATS    15
  137. #define SYS_RPC_ENABLE_SERVICE    16
  138. #define SYS_GET_VERSION_STRING    17
  139. #define SYS_PROC_MIGRATION    18
  140. #define    SYS_DISK_STATS        19
  141. #define SYS_FS_PREFIX_EXPORT    20
  142. #define SYS_LOCK_STATS        21
  143. #define SYS_RPC_SRV_COUNTS    22
  144. #define SYS_RPC_CALL_COUNTS    23
  145. #define SYS_LOCK_RESET_STATS    24
  146. #define SYS_INST_COUNTS        25
  147. #define SYS_RESET_INST_COUNTS    26
  148. #define SYS_RECOV_STATS        27
  149. #define SYS_FS_RECOV_INFO    28
  150. #define    SYS_RECOV_CLIENT_INFO    29
  151. #define    SYS_RPC_SERVER_TRACE     30
  152. #define    SYS_RPC_SERVER_INFO    31
  153. #define    SYS_RPC_SERVER_FREE    32
  154. #define    SYS_RPC_SET_MAX        33
  155. #define    SYS_RPC_SET_NUM        34
  156. #define    SYS_RPC_NEG_ACKS    35
  157. #define    SYS_RPC_CHANNEL_NEG_ACKS    36
  158. #define SYS_RECOV_ABS_PINGS    37
  159. #define SYS_RECOV_PRINT        38
  160. #define    SYS_RPC_NUM_NACK_BUFS    39
  161. #define    SYS_TRACELOG_STATS    40
  162. #define SYS_START_STATS        100
  163. #define SYS_END_STATS        101
  164. #define SYS_DEV_CHANGE_SCSI_DEBUG 102
  165. #ifdef SOSP91
  166. #define    SYS_SCHED_MORE_STATS    103
  167. #define    SYS_FS_SOSP_MIG_STATS    104
  168. #define    SYS_FS_SOSP_NAME_STATS    105
  169. #define    SYS_FSCACHE_EXTRA_STATS    106
  170. #endif SOSP91
  171. #define SYS_RPC_SANITY_CHECK    107
  172. #define SYS_FS_EXTRA_STATS    108
  173.  
  174.  
  175. /*
  176.  * Options for the Sys_Stats SYS_RPC_TRACE_STATS command.  If the option
  177.  * is a positive value then that number of trace records are returned
  178.  * into the buffer referenced by argPtr.
  179.  */
  180. #define SYS_RPC_TRACING_PRINT    -1
  181. #define SYS_RPC_TRACING_OFF    -2
  182. #define SYS_RPC_TRACING_ON    -3
  183.  
  184. /*
  185.  * Options for the Sys_Stats SYS_PROC_TRACE_STATS command.  Use these
  186.  * values for the option argument to the Test_Stats call when using
  187.  * the PROC_TRACE_STATS command.  Any argument greater than the
  188.  * largest positive defined constant is the number of trace records to
  189.  * copy into the output buffer (i.e., it is not permissible to copy
  190.  * only 1-3 records).
  191.  */
  192. #define SYS_PROC_TRACING_PRINT    1
  193. #define SYS_PROC_TRACING_OFF    2
  194. #define SYS_PROC_TRACING_ON    3
  195.  
  196. /*
  197.  * Options for the Sys_Stats SYS_PROC_MIGRATION command.
  198.  * ALLOW, REFUSE, and GET_STATUS are obsoleted by GET_STATE and SET_STATE.
  199.  *
  200.  *   SYS_PROC_MIG_ALLOW        - allow all migrations to this machine.
  201.  *   SYS_PROC_MIG_REFUSE    - refuse all migrations to this machine.
  202.  *   SYS_PROC_MIG_GET_STATUS    - get whether all migrations are allowed
  203.  *                  or refused.
  204.  *   SYS_PROC_MIG_SET_DEBUG    - set the migration debug level.
  205.  *   SYS_PROC_MIG_GET_VERSION    - get the migration version.
  206.  *   SYS_PROC_MIG_GET_STATE    - get the general migration state.
  207.  *   SYS_PROC_MIG_SET_STATE    - set it.
  208.  *   SYS_PROC_MIG_SET_VERSION    - set the migration version.
  209.  *   SYS_PROC_MIG_GET_STATS    - get statistics.
  210.  *   SYS_PROC_MIG_RESET_STATS    - reset statistics.
  211.  */
  212. #define SYS_PROC_MIG_ALLOW        0
  213. #define SYS_PROC_MIG_REFUSE        1
  214. #define SYS_PROC_MIG_GET_STATUS        2
  215. #define SYS_PROC_MIG_SET_DEBUG        3
  216. #define SYS_PROC_MIG_GET_VERSION    4
  217. #define SYS_PROC_MIG_GET_STATE        5
  218. #define SYS_PROC_MIG_SET_STATE        6
  219. #define SYS_PROC_MIG_SET_VERSION    7
  220. #define SYS_PROC_MIG_GET_STATS        8
  221. #define SYS_PROC_MIG_RESET_STATS    9
  222.  
  223. /*
  224.  * Options for SYS_TRACELOG_STATS.
  225.  */
  226. #define SYS_TRACELOG_ON        1
  227. #define SYS_TRACELOG_OFF    2
  228. #define SYS_TRACELOG_DUMP    3
  229. #define SYS_TRACELOG_RESET    4
  230. /* 
  231.  * Structure to return SYS_TRACELOG_STATS.
  232.  */
  233. typedef struct Sys_TracelogRecord {
  234.     int        recordLen;    /* Size of this record in bytes. */
  235.     int        time[2];    /* (Timer_Ticks) Timestamp. */
  236.     ClientData    data;        /* Arbitrarily long data. */
  237. } Sys_TracelogRecord;
  238.  
  239. #define SYS_TRACELOG_KERNELLEN 32
  240. #define SYS_TRACELOG_TYPELEN 8
  241. /*
  242.  * This is the header we write to the user level file.
  243.  * Note: things are in somewhat of a state of flux.  The current status is:
  244.  * File is stored as:
  245.  *   magic #
  246.  *   Sys_TracelogHeader
  247.  *   A bunch of records
  248.  * The fields: numBytes, numRecs, and lostRecords are not used.
  249.  * The traceDir is filled in by the user-level dump program.
  250.  * Lost records are indicated by a special record type in the file.
  251.  * The reason for this format is that it is inconvenient to have the length
  252.  * in the header, since any routine post-processing data and writing a
  253.  * new file would have to go back and modify the header after it knew
  254.  * how many records it had.  This way, you write out a fixed header and
  255.  * then whatever records you want.
  256.  */
  257. typedef struct Sys_TracelogHeader {
  258.     int        numBytes;    /* Total size of the records in bytes. */
  259.                 /* Flags are stored in the high 2 bytes. */
  260.     int        numRecs;    /* Number of records. */
  261.     int        machineID;    /* ID of this machine. */
  262.     char    kernel[SYS_TRACELOG_KERNELLEN];    /* Kernel we're running. */
  263.     char    machineType[SYS_TRACELOG_TYPELEN]; /* Machine type. */
  264.     int        bootTime[2];    /* Time of boot (to convert of trace time. */
  265.     int        lostRecords;    /* Records lost from overflow. */
  266.     int        traceDir[4];    /* FileID of the trace directory. */
  267. } Sys_TracelogHeader;
  268.  
  269. /*
  270.  * This is the structure returned by the kernel.
  271.  */
  272. typedef struct Sys_TracelogHeaderKern {
  273.     int        numBytes;    /* Total size of the records in bytes. */
  274.                 /* Flags are stored in the high 2 bytes. */
  275.     int        numRecs;    /* Number of records. */
  276.     int        machineID;    /* ID of this machine. */
  277.     char    kernel[SYS_TRACELOG_KERNELLEN];    /* Kernel we're running. */
  278.     char    machineType[SYS_TRACELOG_TYPELEN]; /* Machine type. */
  279.     int        bootTime[2];    /* Time of boot (to convert of trace time. */
  280.     int        lostRecords;    /* Records lost from overflow. */
  281. } Sys_TracelogHeaderKern;
  282.  
  283. #define LOST_TYPE 128
  284.  
  285. #define TRACELOG_FLAGMASK 0xf0000000
  286. #define TRACELOG_TYPEMASK 0x0fff0000
  287. #define TRACELOG_BYTEMASK 0x0000ffff
  288.  
  289. #define TRACELOG_MAGIC 0x44554d50
  290. #define TRACELOG_MAGIC2 0x44554d51
  291.  
  292. /*
  293.  * Structure to return for disk stats.
  294.  */
  295. #define    SYS_DISK_NAME_LENGTH    100
  296. typedef struct Sys_DiskStats {
  297.     char    name[SYS_DISK_NAME_LENGTH];    /* Type of disk. */
  298.     int        controllerID;            /* Which controller it is. */
  299.     int        numSamples;            /* Number of times idle time
  300.                          * was sampled. */
  301.     int        idleCount;            /* Number of times disk was
  302.                          * idle when sampled. */
  303.     int        diskReads;            /* The number of sector reads 
  304.                          * from this disk. */
  305.     int        diskWrites;            /* The number of sector writes
  306.                          * from this disk. */
  307. } Sys_DiskStats;
  308.  
  309. #ifdef SOSP91
  310.  
  311. #include <spriteTime.h>
  312.  
  313. typedef    struct    Sys_SchedOverallTimes {
  314.     Time    kernelTime;
  315.     Time    userTime;
  316.     Time    userTimeMigrated;
  317. } Sys_SchedOverallTimes;
  318.  
  319. /*
  320.  * Statistics for name lookup on client.
  321.  */
  322. typedef struct Sys_SospNameStats {
  323.     Time    totalNameTime;
  324.     Time    nameTime;
  325.     Time    prefixTime;
  326.     Time    miscTime;
  327.     int        numPrefixLookups;
  328.     int        numComponents;
  329.     int        numPrefixComponents;
  330. } Sys_SospNameStats;
  331. #endif SOSP91
  332.  
  333. extern ReturnStatus        Sys_Stats();
  334.  
  335. #endif /* _SYSSTATS */
  336.